#include <stdio.h>
#include <map>
#include <string>
#include <utility>

using namespace std;

#define MAXLINE 4096

int main()
{
  char *line = new char[MAXLINE];
  map<string,unsigned int> table;
  map<string,unsigned int>::iterator i;
  unsigned int width, n, max = 0;
  
  fgets(line, MAXLINE, stdin);
  while (!feof(stdin))
  {
    i = table.find(line);
    if (i == table.end()) table.insert(make_pair(line, 1)), n = 1;
    else n = ++(i->second);
    
    if (n > max) max = n;
    
    fgets(line, MAXLINE, stdin);
  }
  
  for (width = 1, n = 10; n <= max; ++width, n *= 10);
  
  for (i = table.begin(); i != table.end(); ++i) printf("%*u %s", width, i->second, i->first.c_str());
  
  delete [] line;
  
  return 0;
}
